package dao;


import java.math.BigDecimal;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Date;
import java.util.Collections;
import java.util.List;

import org.apache.commons.lang.ObjectUtils;
import org.apache.torque.TorqueException;
import org.apache.torque.om.BaseObject;
import org.apache.torque.om.ComboKey;
import org.apache.torque.om.DateKey;
import org.apache.torque.om.NumberKey;
import org.apache.torque.om.ObjectKey;
import org.apache.torque.om.SimpleKey;
import org.apache.torque.om.StringKey;
import org.apache.torque.om.Persistent;
import org.apache.torque.util.Criteria;
import org.apache.torque.util.Transaction;

  
  
/**
 * This class was autogenerated by Torque on:
 *
 * [Fri Jan 09 02:39:32 PST 2009]
 *
 * You should not use this class directly.  It should not even be
 * extended all references should be to Province
 */
public abstract class BaseProvince extends BaseObject
{
    /** The Peer class */
    private static final ProvincePeer peer =
        new ProvincePeer();

        
    /** The value for the provinceid field */
    private int provinceid;
      
    /** The value for the provincecode field */
    private String provincecode;
      
    /** The value for the provincename field */
    private String provincename;
      
    /** The value for the regionid field */
    private int regionid;
  
    
    /**
     * Get the Provinceid
     *
     * @return int
     */
    public int getProvinceid()
    {
        return provinceid;
    }

                                              
    /**
     * Set the value of Provinceid
     *
     * @param v new value
     */
    public void setProvinceid(int v) throws TorqueException
    {
    
                  if (this.provinceid != v)
              {
            this.provinceid = v;
            setModified(true);
        }
    
          
                                  
        // update associated Zip
        if (collZips != null)
        {
            for (int i = 0; i < collZips.size(); i++)
            {
                ((Zip) collZips.get(i))
                    .setProvinceid(v);
            }
        }
                                          
        // update associated StudentPersonalInformation
        if (collStudentPersonalInformationsRelatedByResidentialaddressprovinceid != null)
        {
            for (int i = 0; i < collStudentPersonalInformationsRelatedByResidentialaddressprovinceid.size(); i++)
            {
                ((StudentPersonalInformation) collStudentPersonalInformationsRelatedByResidentialaddressprovinceid.get(i))
                    .setResidentialaddressprovinceid(v);
            }
        }
                                          
        // update associated StudentPersonalInformation
        if (collStudentPersonalInformationsRelatedByCollegeaddressprovinceid != null)
        {
            for (int i = 0; i < collStudentPersonalInformationsRelatedByCollegeaddressprovinceid.size(); i++)
            {
                ((StudentPersonalInformation) collStudentPersonalInformationsRelatedByCollegeaddressprovinceid.get(i))
                    .setCollegeaddressprovinceid(v);
            }
        }
                                          
        // update associated StudentPersonalInformation
        if (collStudentPersonalInformationsRelatedByGuardianaddressprovinceid != null)
        {
            for (int i = 0; i < collStudentPersonalInformationsRelatedByGuardianaddressprovinceid.size(); i++)
            {
                ((StudentPersonalInformation) collStudentPersonalInformationsRelatedByGuardianaddressprovinceid.get(i))
                    .setGuardianaddressprovinceid(v);
            }
        }
                      }
  
    /**
     * Get the Provincecode
     *
     * @return String
     */
    public String getProvincecode()
    {
        return provincecode;
    }

                        
    /**
     * Set the value of Provincecode
     *
     * @param v new value
     */
    public void setProvincecode(String v) 
    {
    
                  if (!ObjectUtils.equals(this.provincecode, v))
              {
            this.provincecode = v;
            setModified(true);
        }
    
          
              }
  
    /**
     * Get the Provincename
     *
     * @return String
     */
    public String getProvincename()
    {
        return provincename;
    }

                        
    /**
     * Set the value of Provincename
     *
     * @param v new value
     */
    public void setProvincename(String v) 
    {
    
                  if (!ObjectUtils.equals(this.provincename, v))
              {
            this.provincename = v;
            setModified(true);
        }
    
          
              }
  
    /**
     * Get the Regionid
     *
     * @return int
     */
    public int getRegionid()
    {
        return regionid;
    }

                              
    /**
     * Set the value of Regionid
     *
     * @param v new value
     */
    public void setRegionid(int v) throws TorqueException
    {
    
                  if (this.regionid != v)
              {
            this.regionid = v;
            setModified(true);
        }
    
                          
                if (aRegion != null && !(aRegion.getRegionid() == v))
                {
            aRegion = null;
        }
      
              }
  
      
    
                  
    
        private Region aRegion;

    /**
     * Declares an association between this object and a Region object
     *
     * @param v Region
     * @throws TorqueException
     */
    public void setRegion(Region v) throws TorqueException
    {
            if (v == null)
        {
                    setRegionid(0);
                  }
        else
        {
            setRegionid(v.getRegionid());
        }
                aRegion = v;
    }

                                            
    /**
     * Get the associated Region object
     *
     * @return the associated Region object
     * @throws TorqueException
     */
    public Region getRegion() throws TorqueException
    {
        if (aRegion == null && (this.regionid > 0))
        {
                          aRegion = RegionPeer.retrieveByPK(SimpleKey.keyFor(this.regionid));
              
            /* The following can be used instead of the line above to
               guarantee the related object contains a reference
               to this object, but this level of coupling
               may be undesirable in many circumstances.
               As it can lead to a db query with many results that may
               never be used.
               Region obj = RegionPeer.retrieveByPK(this.regionid);
               obj.addProvinces(this);
            */
        }
        return aRegion;
    }

    /**
     * Provides convenient way to set a relationship based on a
     * ObjectKey.  e.g.
     * <code>bar.setFooKey(foo.getPrimaryKey())</code>
     *
           */
    public void setRegionKey(ObjectKey key) throws TorqueException
    {
      
                        setRegionid(((NumberKey) key).intValue());
                  }
       
                                
            
    /**
     * Collection to store aggregation of collZips
     */
    protected List collZips;

    /**
     * Temporary storage of collZips to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initZips()
    {
        if (collZips == null)
        {
            collZips = new ArrayList();
        }
    }

    /**
     * Method called to associate a Zip object to this object
     * through the Zip foreign key attribute
     *
     * @param l Zip
     * @throws TorqueException
     */
    public void addZip(Zip l) throws TorqueException
    {
        getZips().add(l);
        l.setProvince((Province) this);
    }

    /**
     * The criteria used to select the current contents of collZips
     */
    private Criteria lastZipsCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getZips(new Criteria())
     *
     * @throws TorqueException
     */
    public List getZips() throws TorqueException
    {
        if (collZips == null)
        {
            collZips = getZips(new Criteria(10));
        }
        return collZips;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province has previously
     * been saved, it will retrieve related Zips from storage.
     * If this Province is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getZips(Criteria criteria) throws TorqueException
    {
        if (collZips == null)
        {
            if (isNew())
            {
               collZips = new ArrayList();
            }
            else
            {
                      criteria.add(ZipPeer.PROVINCEID, getProvinceid() );
                      collZips = ZipPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                      criteria.add(ZipPeer.PROVINCEID, getProvinceid());
                      if (!lastZipsCriteria.equals(criteria))
                {
                    collZips = ZipPeer.doSelect(criteria);
                }
            }
        }
        lastZipsCriteria = criteria;

        return collZips;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getZips(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getZips(Connection con) throws TorqueException
    {
        if (collZips == null)
        {
            collZips = getZips(new Criteria(10), con);
        }
        return collZips;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province has previously
     * been saved, it will retrieve related Zips from storage.
     * If this Province is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getZips(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collZips == null)
        {
            if (isNew())
            {
               collZips = new ArrayList();
            }
            else
            {
                       criteria.add(ZipPeer.PROVINCEID, getProvinceid());
                       collZips = ZipPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                       criteria.add(ZipPeer.PROVINCEID, getProvinceid());
                       if (!lastZipsCriteria.equals(criteria))
                 {
                     collZips = ZipPeer.doSelect(criteria, con);
                 }
             }
         }
         lastZipsCriteria = criteria;

         return collZips;
     }

                  
              
                    
                              
                                
                                                              
                                        
                    
                    
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related Zips from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getZipsJoinProvince(Criteria criteria)
        throws TorqueException
    {
        if (collZips == null)
        {
            if (isNew())
            {
               collZips = new ArrayList();
            }
            else
            {
                            criteria.add(ZipPeer.PROVINCEID, getProvinceid());
                            collZips = ZipPeer.doSelectJoinProvince(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(ZipPeer.PROVINCEID, getProvinceid());
                        if (!lastZipsCriteria.equals(criteria))
            {
                collZips = ZipPeer.doSelectJoinProvince(criteria);
            }
        }
        lastZipsCriteria = criteria;

        return collZips;
    }
                            


                                  
            
    /**
     * Collection to store aggregation of collStudentPersonalInformationsRelatedByResidentialaddressprovinceid
     */
    protected List collStudentPersonalInformationsRelatedByResidentialaddressprovinceid;

    /**
     * Temporary storage of collStudentPersonalInformationsRelatedByResidentialaddressprovinceid to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initStudentPersonalInformationsRelatedByResidentialaddressprovinceid()
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressprovinceid == null)
        {
            collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = new ArrayList();
        }
    }

    /**
     * Method called to associate a StudentPersonalInformation object to this object
     * through the StudentPersonalInformation foreign key attribute
     *
     * @param l StudentPersonalInformation
     * @throws TorqueException
     */
    public void addStudentPersonalInformationRelatedByResidentialaddressprovinceid(StudentPersonalInformation l) throws TorqueException
    {
        getStudentPersonalInformationsRelatedByResidentialaddressprovinceid().add(l);
        l.setProvinceRelatedByResidentialaddressprovinceid((Province) this);
    }

    /**
     * The criteria used to select the current contents of collStudentPersonalInformationsRelatedByResidentialaddressprovinceid
     */
    private Criteria lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getStudentPersonalInformationsRelatedByResidentialaddressprovinceid(new Criteria())
     *
     * @throws TorqueException
     */
    public List getStudentPersonalInformationsRelatedByResidentialaddressprovinceid() throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressprovinceid == null)
        {
            collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = getStudentPersonalInformationsRelatedByResidentialaddressprovinceid(new Criteria(10));
        }
        return collStudentPersonalInformationsRelatedByResidentialaddressprovinceid;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddressprovinceid from storage.
     * If this Province is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getStudentPersonalInformationsRelatedByResidentialaddressprovinceid(Criteria criteria) throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = new ArrayList();
            }
            else
            {
                      criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSPROVINCEID, getProvinceid() );
                      collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = StudentPersonalInformationPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                      criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSPROVINCEID, getProvinceid());
                      if (!lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria.equals(criteria))
                {
                    collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = StudentPersonalInformationPeer.doSelect(criteria);
                }
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddressprovinceid;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getStudentPersonalInformationsRelatedByResidentialaddressprovinceid(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getStudentPersonalInformationsRelatedByResidentialaddressprovinceid(Connection con) throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressprovinceid == null)
        {
            collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = getStudentPersonalInformationsRelatedByResidentialaddressprovinceid(new Criteria(10), con);
        }
        return collStudentPersonalInformationsRelatedByResidentialaddressprovinceid;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddressprovinceid from storage.
     * If this Province is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getStudentPersonalInformationsRelatedByResidentialaddressprovinceid(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = new ArrayList();
            }
            else
            {
                       criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSPROVINCEID, getProvinceid());
                       collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = StudentPersonalInformationPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                       criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSPROVINCEID, getProvinceid());
                       if (!lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria.equals(criteria))
                 {
                     collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = StudentPersonalInformationPeer.doSelect(criteria, con);
                 }
             }
         }
         lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria = criteria;

         return collStudentPersonalInformationsRelatedByResidentialaddressprovinceid;
     }

                                                                                          
              
                    
                    
                                
                                                              
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddressprovinceidJoinStudent(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinStudent(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinStudent(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddressprovinceid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddressprovinceidJoinZipRelatedByResidentialaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByResidentialaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByResidentialaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddressprovinceid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                            
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddressprovinceidJoinRegionRelatedByResidentialaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByResidentialaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByResidentialaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddressprovinceid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddressprovinceidJoinCountryRelatedByResidentialaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByResidentialaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByResidentialaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddressprovinceid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddressprovinceidJoinZipRelatedByCollegeaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByCollegeaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByCollegeaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddressprovinceid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddressprovinceidJoinProvinceRelatedByCollegeaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByCollegeaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByCollegeaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddressprovinceid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddressprovinceidJoinRegionRelatedByCollegeaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByCollegeaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByCollegeaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddressprovinceid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddressprovinceidJoinCountryRelatedByCollegeaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByCollegeaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByCollegeaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddressprovinceid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddressprovinceidJoinZipRelatedByGuardianaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByGuardianaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByGuardianaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddressprovinceid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddressprovinceidJoinProvinceRelatedByGuardianaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByGuardianaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByGuardianaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddressprovinceid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddressprovinceidJoinRegionRelatedByGuardianaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByGuardianaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByGuardianaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddressprovinceid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddressprovinceidJoinCountryRelatedByGuardianaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByGuardianaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByGuardianaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddressprovinceid;
    }
                            


                                  
            
    /**
     * Collection to store aggregation of collStudentPersonalInformationsRelatedByCollegeaddressprovinceid
     */
    protected List collStudentPersonalInformationsRelatedByCollegeaddressprovinceid;

    /**
     * Temporary storage of collStudentPersonalInformationsRelatedByCollegeaddressprovinceid to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initStudentPersonalInformationsRelatedByCollegeaddressprovinceid()
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressprovinceid == null)
        {
            collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = new ArrayList();
        }
    }

    /**
     * Method called to associate a StudentPersonalInformation object to this object
     * through the StudentPersonalInformation foreign key attribute
     *
     * @param l StudentPersonalInformation
     * @throws TorqueException
     */
    public void addStudentPersonalInformationRelatedByCollegeaddressprovinceid(StudentPersonalInformation l) throws TorqueException
    {
        getStudentPersonalInformationsRelatedByCollegeaddressprovinceid().add(l);
        l.setProvinceRelatedByCollegeaddressprovinceid((Province) this);
    }

    /**
     * The criteria used to select the current contents of collStudentPersonalInformationsRelatedByCollegeaddressprovinceid
     */
    private Criteria lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getStudentPersonalInformationsRelatedByCollegeaddressprovinceid(new Criteria())
     *
     * @throws TorqueException
     */
    public List getStudentPersonalInformationsRelatedByCollegeaddressprovinceid() throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressprovinceid == null)
        {
            collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = getStudentPersonalInformationsRelatedByCollegeaddressprovinceid(new Criteria(10));
        }
        return collStudentPersonalInformationsRelatedByCollegeaddressprovinceid;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddressprovinceid from storage.
     * If this Province is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getStudentPersonalInformationsRelatedByCollegeaddressprovinceid(Criteria criteria) throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = new ArrayList();
            }
            else
            {
                      criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSPROVINCEID, getProvinceid() );
                      collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = StudentPersonalInformationPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                      criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSPROVINCEID, getProvinceid());
                      if (!lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria.equals(criteria))
                {
                    collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = StudentPersonalInformationPeer.doSelect(criteria);
                }
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddressprovinceid;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getStudentPersonalInformationsRelatedByCollegeaddressprovinceid(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getStudentPersonalInformationsRelatedByCollegeaddressprovinceid(Connection con) throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressprovinceid == null)
        {
            collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = getStudentPersonalInformationsRelatedByCollegeaddressprovinceid(new Criteria(10), con);
        }
        return collStudentPersonalInformationsRelatedByCollegeaddressprovinceid;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddressprovinceid from storage.
     * If this Province is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getStudentPersonalInformationsRelatedByCollegeaddressprovinceid(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = new ArrayList();
            }
            else
            {
                       criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSPROVINCEID, getProvinceid());
                       collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = StudentPersonalInformationPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                       criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSPROVINCEID, getProvinceid());
                       if (!lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria.equals(criteria))
                 {
                     collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = StudentPersonalInformationPeer.doSelect(criteria, con);
                 }
             }
         }
         lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria = criteria;

         return collStudentPersonalInformationsRelatedByCollegeaddressprovinceid;
     }

                                                                                          
              
                    
                    
                                
                                                              
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddressprovinceidJoinStudent(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinStudent(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinStudent(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddressprovinceid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddressprovinceidJoinZipRelatedByResidentialaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByResidentialaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByResidentialaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddressprovinceid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddressprovinceidJoinProvinceRelatedByResidentialaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByResidentialaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByResidentialaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddressprovinceid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddressprovinceidJoinRegionRelatedByResidentialaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByResidentialaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByResidentialaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddressprovinceid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddressprovinceidJoinCountryRelatedByResidentialaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByResidentialaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByResidentialaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddressprovinceid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddressprovinceidJoinZipRelatedByCollegeaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByCollegeaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByCollegeaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddressprovinceid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                            
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddressprovinceidJoinRegionRelatedByCollegeaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByCollegeaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByCollegeaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddressprovinceid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddressprovinceidJoinCountryRelatedByCollegeaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByCollegeaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByCollegeaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddressprovinceid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddressprovinceidJoinZipRelatedByGuardianaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByGuardianaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByGuardianaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddressprovinceid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddressprovinceidJoinProvinceRelatedByGuardianaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByGuardianaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByGuardianaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddressprovinceid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddressprovinceidJoinRegionRelatedByGuardianaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByGuardianaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByGuardianaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddressprovinceid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddressprovinceidJoinCountryRelatedByGuardianaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByGuardianaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByGuardianaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddressprovinceid;
    }
                            


                                  
            
    /**
     * Collection to store aggregation of collStudentPersonalInformationsRelatedByGuardianaddressprovinceid
     */
    protected List collStudentPersonalInformationsRelatedByGuardianaddressprovinceid;

    /**
     * Temporary storage of collStudentPersonalInformationsRelatedByGuardianaddressprovinceid to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initStudentPersonalInformationsRelatedByGuardianaddressprovinceid()
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressprovinceid == null)
        {
            collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = new ArrayList();
        }
    }

    /**
     * Method called to associate a StudentPersonalInformation object to this object
     * through the StudentPersonalInformation foreign key attribute
     *
     * @param l StudentPersonalInformation
     * @throws TorqueException
     */
    public void addStudentPersonalInformationRelatedByGuardianaddressprovinceid(StudentPersonalInformation l) throws TorqueException
    {
        getStudentPersonalInformationsRelatedByGuardianaddressprovinceid().add(l);
        l.setProvinceRelatedByGuardianaddressprovinceid((Province) this);
    }

    /**
     * The criteria used to select the current contents of collStudentPersonalInformationsRelatedByGuardianaddressprovinceid
     */
    private Criteria lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getStudentPersonalInformationsRelatedByGuardianaddressprovinceid(new Criteria())
     *
     * @throws TorqueException
     */
    public List getStudentPersonalInformationsRelatedByGuardianaddressprovinceid() throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressprovinceid == null)
        {
            collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = getStudentPersonalInformationsRelatedByGuardianaddressprovinceid(new Criteria(10));
        }
        return collStudentPersonalInformationsRelatedByGuardianaddressprovinceid;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddressprovinceid from storage.
     * If this Province is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getStudentPersonalInformationsRelatedByGuardianaddressprovinceid(Criteria criteria) throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = new ArrayList();
            }
            else
            {
                      criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSPROVINCEID, getProvinceid() );
                      collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = StudentPersonalInformationPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                      criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSPROVINCEID, getProvinceid());
                      if (!lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria.equals(criteria))
                {
                    collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = StudentPersonalInformationPeer.doSelect(criteria);
                }
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddressprovinceid;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getStudentPersonalInformationsRelatedByGuardianaddressprovinceid(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getStudentPersonalInformationsRelatedByGuardianaddressprovinceid(Connection con) throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressprovinceid == null)
        {
            collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = getStudentPersonalInformationsRelatedByGuardianaddressprovinceid(new Criteria(10), con);
        }
        return collStudentPersonalInformationsRelatedByGuardianaddressprovinceid;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddressprovinceid from storage.
     * If this Province is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getStudentPersonalInformationsRelatedByGuardianaddressprovinceid(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = new ArrayList();
            }
            else
            {
                       criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSPROVINCEID, getProvinceid());
                       collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = StudentPersonalInformationPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                       criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSPROVINCEID, getProvinceid());
                       if (!lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria.equals(criteria))
                 {
                     collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = StudentPersonalInformationPeer.doSelect(criteria, con);
                 }
             }
         }
         lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria = criteria;

         return collStudentPersonalInformationsRelatedByGuardianaddressprovinceid;
     }

                                                                                          
              
                    
                    
                                
                                                              
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddressprovinceidJoinStudent(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinStudent(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinStudent(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddressprovinceid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddressprovinceidJoinZipRelatedByResidentialaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByResidentialaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByResidentialaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddressprovinceid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddressprovinceidJoinProvinceRelatedByResidentialaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByResidentialaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByResidentialaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddressprovinceid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddressprovinceidJoinRegionRelatedByResidentialaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByResidentialaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByResidentialaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddressprovinceid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddressprovinceidJoinCountryRelatedByResidentialaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByResidentialaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByResidentialaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddressprovinceid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddressprovinceidJoinZipRelatedByCollegeaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByCollegeaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByCollegeaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddressprovinceid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddressprovinceidJoinProvinceRelatedByCollegeaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByCollegeaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByCollegeaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddressprovinceid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddressprovinceidJoinRegionRelatedByCollegeaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByCollegeaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByCollegeaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddressprovinceid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddressprovinceidJoinCountryRelatedByCollegeaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByCollegeaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByCollegeaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddressprovinceid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddressprovinceidJoinZipRelatedByGuardianaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByGuardianaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByGuardianaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddressprovinceid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                            
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddressprovinceidJoinRegionRelatedByGuardianaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByGuardianaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByGuardianaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddressprovinceid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Province is new, it will return
     * an empty collection; or if this Province has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddressprovinceid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Province.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddressprovinceidJoinCountryRelatedByGuardianaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddressprovinceid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSPROVINCEID, getProvinceid());
                            collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByGuardianaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSPROVINCEID, getProvinceid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddressprovinceid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByGuardianaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddressprovinceidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddressprovinceid;
    }
                            


          
    private static List fieldNames = null;

    /**
     * Generate a list of field names.
     *
     * @return a list of field names
     */
    public static synchronized List getFieldNames()
    {
        if (fieldNames == null)
        {
            fieldNames = new ArrayList();
              fieldNames.add("Provinceid");
              fieldNames.add("Provincecode");
              fieldNames.add("Provincename");
              fieldNames.add("Regionid");
              fieldNames = Collections.unmodifiableList(fieldNames);
        }
        return fieldNames;
    }

    /**
     * Retrieves a field from the object by name passed in as a String.
     *
     * @param name field name
     * @return value
     */
    public Object getByName(String name)
    {
          if (name.equals("Provinceid"))
        {
                return new Integer(getProvinceid());
            }
          if (name.equals("Provincecode"))
        {
                return getProvincecode();
            }
          if (name.equals("Provincename"))
        {
                return getProvincename();
            }
          if (name.equals("Regionid"))
        {
                return new Integer(getRegionid());
            }
          return null;
    }
    
    /**
     * Retrieves a field from the object by name passed in
     * as a String.  The String must be one of the static
     * Strings defined in this Class' Peer.
     *
     * @param name peer name
     * @return value
     */
    public Object getByPeerName(String name)
    {
          if (name.equals(ProvincePeer.PROVINCEID))
        {
                return new Integer(getProvinceid());
            }
          if (name.equals(ProvincePeer.PROVINCECODE))
        {
                return getProvincecode();
            }
          if (name.equals(ProvincePeer.PROVINCENAME))
        {
                return getProvincename();
            }
          if (name.equals(ProvincePeer.REGIONID))
        {
                return new Integer(getRegionid());
            }
          return null;
    }

    /**
     * Retrieves a field from the object by Position as specified
     * in the xml schema.  Zero-based.
     *
     * @param pos position in xml schema
     * @return value
     */
    public Object getByPosition(int pos)
    {
            if (pos == 0)
        {
                return new Integer(getProvinceid());
            }
              if (pos == 1)
        {
                return getProvincecode();
            }
              if (pos == 2)
        {
                return getProvincename();
            }
              if (pos == 3)
        {
                return new Integer(getRegionid());
            }
              return null;
    }
     
    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.
     *
     * @throws Exception
     */
    public void save() throws Exception
    {
          save(ProvincePeer.getMapBuilder()
                .getDatabaseMap().getName());
      }

    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.
       * Note: this code is here because the method body is
     * auto-generated conditionally and therefore needs to be
     * in this file instead of in the super class, BaseObject.
       *
     * @param dbName
     * @throws TorqueException
     */
    public void save(String dbName) throws TorqueException
    {
        Connection con = null;
          try
        {
            con = Transaction.begin(dbName);
            save(con);
            Transaction.commit(con);
        }
        catch(TorqueException e)
        {
            Transaction.safeRollback(con);
            throw e;
        }
      }

      /** flag to prevent endless save loop, if this object is referenced
        by another object which falls in this transaction. */
    private boolean alreadyInSave = false;
      /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.  This method
     * is meant to be used as part of a transaction, otherwise use
     * the save() method and the connection details will be handled
     * internally
     *
     * @param con
     * @throws TorqueException
     */
    public void save(Connection con) throws TorqueException
    {
          if (!alreadyInSave)
        {
            alreadyInSave = true;


  
            // If this object has been modified, then save it to the database.
            if (isModified())
            {
                if (isNew())
                {
                    ProvincePeer.doInsert((Province) this, con);
                    setNew(false);
                }
                else
                {
                    ProvincePeer.doUpdate((Province) this, con);
                }
            }

                                      
                
            if (collZips != null)
            {
                for (int i = 0; i < collZips.size(); i++)
                {
                    ((Zip) collZips.get(i)).save(con);
                }
            }
                                                    
                
            if (collStudentPersonalInformationsRelatedByResidentialaddressprovinceid != null)
            {
                for (int i = 0; i < collStudentPersonalInformationsRelatedByResidentialaddressprovinceid.size(); i++)
                {
                    ((StudentPersonalInformation) collStudentPersonalInformationsRelatedByResidentialaddressprovinceid.get(i)).save(con);
                }
            }
                                                    
                
            if (collStudentPersonalInformationsRelatedByCollegeaddressprovinceid != null)
            {
                for (int i = 0; i < collStudentPersonalInformationsRelatedByCollegeaddressprovinceid.size(); i++)
                {
                    ((StudentPersonalInformation) collStudentPersonalInformationsRelatedByCollegeaddressprovinceid.get(i)).save(con);
                }
            }
                                                    
                
            if (collStudentPersonalInformationsRelatedByGuardianaddressprovinceid != null)
            {
                for (int i = 0; i < collStudentPersonalInformationsRelatedByGuardianaddressprovinceid.size(); i++)
                {
                    ((StudentPersonalInformation) collStudentPersonalInformationsRelatedByGuardianaddressprovinceid.get(i)).save(con);
                }
            }
                          alreadyInSave = false;
        }
      }


                          
      /**
     * Set the PrimaryKey using ObjectKey.
     *
     * @param  provinceid ObjectKey
     */
    public void setPrimaryKey(ObjectKey key)
        throws TorqueException
    {
            setProvinceid(((NumberKey) key).intValue());
        }

    /**
     * Set the PrimaryKey using a String.
     *
     * @param key
     */
    public void setPrimaryKey(String key) throws TorqueException
    {
            setProvinceid(Integer.parseInt(key));
        }

  
    /**
     * returns an id that differentiates this object from others
     * of its class.
     */
    public ObjectKey getPrimaryKey()
    {
          return SimpleKey.keyFor(getProvinceid());
      }

 

    /**
     * Makes a copy of this object.
     * It creates a new object filling in the simple attributes.
       * It then fills all the association collections and sets the
     * related objects to isNew=true.
       */
      public Province copy() throws TorqueException
    {
        return copyInto(new Province());
    }
  
    protected Province copyInto(Province copyObj) throws TorqueException
    {
          copyObj.setProvinceid(provinceid);
          copyObj.setProvincecode(provincecode);
          copyObj.setProvincename(provincename);
          copyObj.setRegionid(regionid);
  
                    copyObj.setProvinceid(0);
                              
                                      
                
        List v = getZips();
        for (int i = 0; i < v.size(); i++)
        {
            Zip obj = (Zip) v.get(i);
            copyObj.addZip(obj.copy());
        }
                                                            
                
        v = getStudentPersonalInformationsRelatedByResidentialaddressprovinceid();
        for (int i = 0; i < v.size(); i++)
        {
            StudentPersonalInformation obj = (StudentPersonalInformation) v.get(i);
            copyObj.addStudentPersonalInformationRelatedByResidentialaddressprovinceid(obj.copy());
        }
                                                            
                
        v = getStudentPersonalInformationsRelatedByCollegeaddressprovinceid();
        for (int i = 0; i < v.size(); i++)
        {
            StudentPersonalInformation obj = (StudentPersonalInformation) v.get(i);
            copyObj.addStudentPersonalInformationRelatedByCollegeaddressprovinceid(obj.copy());
        }
                                                            
                
        v = getStudentPersonalInformationsRelatedByGuardianaddressprovinceid();
        for (int i = 0; i < v.size(); i++)
        {
            StudentPersonalInformation obj = (StudentPersonalInformation) v.get(i);
            copyObj.addStudentPersonalInformationRelatedByGuardianaddressprovinceid(obj.copy());
        }
                    
        return copyObj;
    }

    /**
     * returns a peer instance associated with this om.  Since Peer classes
     * are not to have any instance attributes, this method returns the
     * same instance for all member of this class. The method could therefore
     * be static, but this would prevent one from overriding the behavior.
     */
    public ProvincePeer getPeer()
    {
        return peer;
    }

    public String toString()
    {
        StringBuffer str = new StringBuffer();
        str.append("Province:\n");
        str.append("Provinceid = ")
           .append(getProvinceid())
           .append("\n");
        str.append("Provincecode = ")
           .append(getProvincecode())
           .append("\n");
        str.append("Provincename = ")
           .append(getProvincename())
           .append("\n");
        str.append("Regionid = ")
           .append(getRegionid())
           .append("\n");
        return(str.toString());
    }
}
